BiYacc: Roll Your Parser and Reflective Printer into One
نویسندگان
چکیده
Language designers usually need to implement parsers and printers. Despite being two related programs, in practice they are designed and implemented separately. This approach has an obvious disadvantage: as a language evolves, both its parser and printer need to be separately revised and kept synchronised. Such tasks are routine but complicated and error-prone. To facilitate these tasks, we propose a language called BiYacc, whose programs denote both a parser and a printer. In essence, BiYacc is a domain-specific language for writing putback-based bidirectional transformations — the printer is a putback transformation, and the parser is the corresponding get transformation. The pairs of parsers and printers generated by BiYacc are thus always guaranteed to satisfy the usual round-trip properties. The highlight that distinguishes this reflective printer from others is that the printer — being a putback transformation — accepts not only an abstract syntax tree but also a string, and produces an updated string consistent with the given abstract syntax tree. We can thus make use of the additional input string, with mechanisms such as simultaneous pattern matching on the view and the source, to provide users with full control over the printing-strategies.
منابع مشابه
Feature Engineering in Persian Dependency Parser
Dependency parser is one of the most important fundamental tools in the natural language processing, which extracts structure of sentences and determines the relations between words based on the dependency grammar. The dependency parser is proper for free order languages, such as Persian. In this paper, data-driven dependency parser has been developed with the help of phrase-structure parser fo...
متن کاملFunctional Pearl: Replaying the stack for parsing and pretty printing
Modulo inessential details, parsers and pretty printers, to and from algebraic datatypes, offer an uncanny resemblance and yet are all too often defined separately, in gross violation of the “don’t repeat yourself” principle. We present a family of reversible parser/printer combinators that allows one to define both at once in a type-safe manner, compositionally and without any need for a prepr...
متن کاملMARS: A Specialized RTE System for Parser Evaluation
This paper describes our participation in the the SemEval-2010 Task #12, Parser Evaluation using Textual Entailment. Our system incorporated two dependency parsers, one semantic role labeler, and a deep parser based on hand-crafted grammars. The shortest path algorithm is applied on the graph representation of the parser outputs. Then, different types of features are extracted and the entailmen...
متن کاملSUBlVUTTED TO THE PROGRAM IN MEDIA ARTS AND SCIENCES, SCHOOL OF ARCIDTECTURE AND PLANNING IN PARTIAL FULFILLEMENT OF THE REQUIREMENTS FOR THE DEGREE OF Master of Science
This thesis introduces digital materials by analogy with digital computation and digital communications. Traditional fabrication techniques include pick-and-place, roll-to-roll, molding, patterning and more. Current research in fabrication includes algorithmic assembly [3], programmed assembly[9], self-assembly[1,2], assembly by folding [4] as well as guided self-assembly [2]. While these resea...
متن کاملHow to Pretty-Print a Long Formula
We propose a structured rendering for higher-order logic (HOL) to make specifications more readable. Furthermore, we present a freely-available parser and pretty-printer that implements these ideas, which we call BeautifHOL. We conclude by describing possible extensions to our proposal and motivate the need for formatting standards for formal specifications, generally.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2015